<template>
    <myx-table
               :showTableMiddle="false"
               :showTableSearch="false"
               :data="data"
               :tableAttr="{ border: true }"
               :column="columns"
               :tableLoading="tableLoading"></myx-table>
</template>
<script setup>

let data = ref([])

let columns = ref([
    {
        key: 'name',
        dataIndex: 'name',
        align: 'center',
        label: '姓名'
    },
    {
        key: "position",
        dataIndex: 'position',
        label: '职位',
        align:'center'
    },
    {
        key: 'group',
        dataIndex: 'group',
        label: '部门',
        align: 'center'
    },
    {
        key: 'fullDays',
        label: '应出勤天数',
        dataIndex: 'fullDays',
        align: 'center'
    },
    {
        key: 'currentDays',
        dataIndex: "currentDays",
        label: '实际出勤天数',
        align: 'center'
    }
])

let tableLoading = ref(false)

let getAttendance = async () => {
    tableLoading.value = true;
    try {
        let res = await api.getAttendanceApi()
        console.log(res)
        tableLoading.value = false
        data.value = res.data
    } catch (e) {
        ElMessage.error(e.toString())
    }
}
onMounted(() => {
    getAttendance()
})
</script>
<script>
export default {
    name: 'attendance',
    meta: {
        //这个字段要和服务器所有菜单数据中,对应一条数据的name一样
        name: "考勤管理",
        icon: "icon-kaoqin_kaoqin_yueqinguanli"
    }
}
</script>